<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">

	<ul class="nav nav-tabs">
        <li class="active"><a class="nav-link" href="{:url('case/add')}">添加公司团队</a></li>
        <li ><a class="nav-link active" href="{:url('case/index')}">公司团队列表</a></li>
        
    </ul>
    
	<div class="row">
		<div class="col-md-12">
			<div class="card-body">
			
			    <form action="{:url('Case/addPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
			        <div class="row">
			            <div class="col-md-9">
			                <table  style="border: 1px solid transparent">
			                    <tr>
			                        <th style="text-align:center;height: 12px">姓名：</th>
			                        <td style='text-align:center;'>
			                            <input class="form-control" type="text" style="width:260px;" name="post[user_name]" id="title"
			                                    value="" placeholder="单行输入"/>
			                        </td>
                                    <th style="width: 50px"></th>
                                    <td></td>
                                    <th rowspan="2" style="width: 100px;text-align:center;vertical-align: top;padding-top: 15px;">专家照片：</th>
                                    <td rowspan="2" style='text-align:center;'>
                                        <input style="display: none" id="file0" type="file" name='user_img'>
                                        <label  for="file0"><img src="./effect/image/jia.png" id="img0" style="width: 80px;height: 110px;"></label>
                                    </td>
			                    </tr>
			                    <tr>
			                        <th style="text-align:center;height: 12px">职位：</th>
			                        <td style='text-align:center;'>
			                            <input class="form-control" type="text" name="post[user_job]" id="keywords" value=""
			                                   style="width: 260px" placeholder="单行输入">
			                        </td>
			                    </tr>
                                <tr>
                                    
                                </tr>
                            </table>
                            <div  class='jia_content'>

                                <table  style="border: 1px solid transparent" class='table_content'>
    			                    <tr>
    			                        <th style="text-align:center;height: 12px">标题：</th>
                                        <td style='text-align:center;'>
                                            <input class="form-control" type="text" name="post[title][]" id="keywords" value=""
                                                   style="width: 260px" placeholder="单行输入">
                                        </td>  
                                        <th style="width: 50px"></th>
                                        <th style="width: 50px">内容:</th>                             
                                        <td style="padding-top: 45px;"><textarea class="form-control"  rows='3' style='width:260px;' name="post[content][]" placeholder="多行输入"></textarea></td>
                                         <th style="width: 50px"></th>
                                        <td><lable   style='font-weight: bold;font-size: 60px;' class='jia'>＋</lable></td>
                                        <td><lable   style='font-weight: bold;font-size: 60px;' class='jian'>－</lable></td>
    			                    </tr>                                                                            			                 
    			                </table>

                            </div>
                            <table  style="border: 1px solid transparent;">
                                <tr>
                                    <td> <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button></td>
                                    <td>  <a class="btn btn-default" href="{:url('case/index')}">{:lang('BACK')}</a></td>
                                </tr>
                            </table>
			            </div>
			          

			        
			    </form>

			</div>
		</div>
	</div>
</div>
</body>
<block name="script">

<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script>
    $(document).on('click','.jia',function(){
        var str =  '<table  style="border: 1px solid transparent" class="table_content"> '
            str += '<tr>'
            str += '<th style="text-align:center;height: 12px">标题：</th>'
            str += '<td style="text-align:center;">'
            str += '<input class="form-control" type="text" name="post[title][]" id="keywords" value="" style="width: 260px" placeholder="单行输入">'
            str += '</td>'  
            str += '<th style="width: 50px"></th>'
            str += '<th style="width: 50px">内容:</th>  '                           
            str += '<td style="padding-top: 45px;"><textarea class="form-control"  rows="3" style="width:260px;" name="post[content][]" placeholder="多行输入"></textarea></td>'
            str += '<th style="width: 50px"></th>'
            str += '<td><lable   style="font-weight: bold;font-size: 60px;" class="jia">＋</lable></td>'
            str += '</tr> '                                                                                                       
            str += '</table>';
        $('.jia_content').append(str);
    })
    $(document).on('click','.jian',function(){
        var count = $('.table_content').length;
        if(count > 1)
        {
            $('.table_content:last').remove();
        }
        
    })
</script>
<script type="text/javascript">
    $(function () {

        editorcontent = new baidu.editor.ui.Editor();
        editorcontent.render('content');
        try {
            editorcontent.sync();
        } catch (err) {
        }

        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });

    });

    function company() {
        $('#project_p').html('');

        openIframeLayer("{:url('Company/find')}", '公司查找', {
            area: ['700px', '400px'],
            btn: ['确定', '取消'],
            yes: function (index, layero) {

                var iframeWin          = window[layero.find('iframe')[0]['name']];
                var all = iframeWin.confirm();

                $('#company_name').val(all.company_name);
                $('#company_id').val(all.company_id);


                //项目查找
                $.ajax({
                    type:'get',
                    url : "{:url('project/search')}?company_id="+all.company_id,
                    dataType:'json',
                    success:function(data)
                    {
                        var data = data.data;
                        if(data.length == 0)
                        {   
                            $('#project_p').html("<lable style='color:red;'>&nbsp;&nbsp;*该公司暂无项目信息,如需要则去项目管理添加<lable>");

                        }else
                        {
                            var str = '';
                            for(var i = 0;i<data.length;i++)
                            {
                                str += "<input type='checkbox' name='all_project[]' value="+data[i]['id']+"> "+data[i]['project_name']+"  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                            }
                            $('#project_p').html(str);
                        }
                    }
                })
                layer.close(index); //如果设定了yes回调，需进行手工关闭
            }
        });
    }

    //  function project() {

    //     openIframeLayer("{:url('project/find')}", '项目查找', {
    //         area: ['700px', '400px'],
    //         btn: ['确定', '取消'],
    //         yes: function (index, layero) {

    //             var iframeWin          = window[layero.find('iframe')[0]['name']];
    //             var all = iframeWin.confirm();

    //             $('#project_id').val(all.project_id);
    //             $('#project_name').val(all.project_name);
    //             layer.close(index); //如果设定了yes回调，需进行手工关闭
    //         }
    //     });
    // }
    // 
$("#file0").change(function(){  
         var objUrl = getObjectURL(this.files[0]) ;//获取文件信息  
         console.log("objUrl = "+objUrl);  
          if (objUrl) {  
          $("#img0").attr("src", objUrl);  
         }   
}) ;  
function getObjectURL(file) {  
         var url = null;   
         if (window.createObjectURL!=undefined) {  
          url = window.createObjectURL(file) ;  
         } else if (window.URL!=undefined) { // mozilla(firefox)  
          url = window.URL.createObjectURL(file) ;  
         } else if (window.webkitURL!=undefined) { // webkit or chrome  
          url = window.webkitURL.createObjectURL(file) ;  
         }  
         return url ;  
        }  


</script>
</block>